<?php

namespace App\Service\Stat;

use App\Helpers\Helper;
use App\Model\Stat\StatAppStartLog;
use App\Service\BaseService;

/**
 * APP启动上报
 */
class StartService extends BaseService
{
    public function handle()
    {
        $params = $this->request->all();
        StatAppStartLog::create([
            'app_id' => $params['appid'] ?? 1,
            'platform' => $params['platform'] ?? 2,
            'device_id' => $params['cid'] ?? '',
            'client_ip' => $params['client_ip'] ?? Helper::getClientIp(),
            'channel' => $params['channel'] ?? '',
            'device' => $params['device'] ?? '',
            'app_version' => $params['version'] ?? '',
            'sys_version' => $params['sys_version'] ?? '',
        ]);
        return ['result' => 1];
    }
}
